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

Query time 0.00042