UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hwDlFLGZqBpkeIE6qkw0X63GcCwZjOFAEcSo9UmdIFA=' 
WHERE 
  key_id = '65e34d309088b620bee1542b3163e13e6cbb371419acbedfeb427183753e34ea' 
  AND (
    token = 'hwDlFLGZqBpkeIE6qkw0X63GcCwZjOFAEcSo9UmdIFA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035