UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Jdi4VzdG8FSGNUL67roeDLDrQ5Q5Hu6wiDyHfqYUs6o=' 
WHERE 
  key_id = '69cd19db2797c5779792586cd306cbe3d8a54ba3ffe45768ee016325daaeb90f' 
  AND (
    token = 'Jdi4VzdG8FSGNUL67roeDLDrQ5Q5Hu6wiDyHfqYUs6o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024