UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pe1ypGw6yPpxoYk1nQDnY0SH4AdqgbV+/HT/Po++Keo=' 
WHERE 
  key_id = '2d929e1b7e45c60d76fa5f796abf6bd5def113848b5ea0ca71c4567fe91728a5' 
  AND (
    token = 'pe1ypGw6yPpxoYk1nQDnY0SH4AdqgbV+/HT/Po++Keo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018