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

Query time 0.00044