UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8ZY32x7O1xx6jDY+plM+qrYoQxTtcUKLVJF7rll/Ucw=' 
WHERE 
  key_id = '6c87185d54af5b5ad697d9e801bb1cdd6cca4c049dc70e654b0d3be55914b94b' 
  AND (
    token = '8ZY32x7O1xx6jDY+plM+qrYoQxTtcUKLVJF7rll/Ucw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028