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