UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V2gHQb9HfqBLtZWjm1OasJjFkl9lqxmeRfMT/bdTrYY=' 
WHERE 
  key_id = '901fc65ca3906ddda0b884beeb3c1716f41df51ca95dab915a4efafdc4b2c5fd' 
  AND (
    token = 'V2gHQb9HfqBLtZWjm1OasJjFkl9lqxmeRfMT/bdTrYY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040