UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IsP5QfJUT8+kofdzLfhd7rbfMVq8eJoRCvKHjf8CP8I=' 
WHERE 
  key_id = 'fd19947442e7650ed2c28f0c378338abaa72459bf5124689e76c525316be1934' 
  AND (
    token = 'IsP5QfJUT8+kofdzLfhd7rbfMVq8eJoRCvKHjf8CP8I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025