UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3YVtNctc+Tf4NYsWZdFzfS39jAbJw7FruUjsblFwUdg='
WHERE
key_id = '9f1b05f5da4f9f1d8ab12406142dec06e81859bec65a70fe1fb4bd38c170385f'
AND (
token = '3YVtNctc+Tf4NYsWZdFzfS39jAbJw7FruUjsblFwUdg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)