UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p/clD6VsgRuHkkdgyU5S9yIZG9znvIPDCHixtDifqC4=' 
WHERE 
  key_id = '29cd3ad9b9d516175c7a017db46b5765d2a4520df505511210b4bd7ca152fe72' 
  AND (
    token = 'p/clD6VsgRuHkkdgyU5S9yIZG9znvIPDCHixtDifqC4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022