UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qF0077rPH+qRTXmZzhLgP2kLa81eohRSHGWs+TbAGlI=' 
WHERE 
  key_id = '170dc5e9fd988fb08621ec784a172ca6e885504d5c2aa6b8bf93b081dfdff98e' 
  AND (
    token = 'qF0077rPH+qRTXmZzhLgP2kLa81eohRSHGWs+TbAGlI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020