UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G7ps8QbEfs8osdEDdGGkoDEJfL1V/IuH+zE4oRYRfoc=' 
WHERE 
  key_id = 'aa1f87a5da8ad264211b9a5d5426cf6f8255d9b01742e75190abfce41f05e654' 
  AND (
    token = 'G7ps8QbEfs8osdEDdGGkoDEJfL1V/IuH+zE4oRYRfoc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030