UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7A16TC7YDFECKTQyLHwXQS1F+Adnm6QFWM8q+cAwr2Y=' 
WHERE 
  key_id = 'd8028823e617cec37ad26d13dce5200adeff9ecdf25629097460761afab57b23' 
  AND (
    token = '7A16TC7YDFECKTQyLHwXQS1F+Adnm6QFWM8q+cAwr2Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039