UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dkSHWwC0mxjWOnOBPJYol52Y3fzt2Ip08qAGds+U3BA=' 
WHERE 
  key_id = 'a71d3461f29e3efa3bad92fe7f4d7a1abf28469454f71bc6b3ed909bc036cd50' 
  AND (
    token = 'dkSHWwC0mxjWOnOBPJYol52Y3fzt2Ip08qAGds+U3BA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037