UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pwYjVG9PjkYDQlYKZf232wt6UoCpIcsUFqXI25qvKyE=' 
WHERE 
  key_id = 'cd392c155b815c2a4e8a57592bd776773fec067a1be775bee954cd0175d2df9c' 
  AND (
    token = 'pwYjVG9PjkYDQlYKZf232wt6UoCpIcsUFqXI25qvKyE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029