UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wPIhYigzlLGEh1GmrOAwEIPeW0Zzzo074+gYxxP+jNw='
WHERE
key_id = 'ecb369a25c632308c8c4915a1816f676fd9d48c0c8585586d1b07f3bc43f2284'
AND (
token = 'wPIhYigzlLGEh1GmrOAwEIPeW0Zzzo074+gYxxP+jNw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)