UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Stf0XVxcV5SQRzLh1scbDYW452wHy7QqhliJNfhij1g=' 
WHERE 
  key_id = '7d3c2283ce0e26250334ff8defe4b28aa112cf3fbf28af6b36d602d9bea79cc8' 
  AND (
    token = 'Stf0XVxcV5SQRzLh1scbDYW452wHy7QqhliJNfhij1g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017