UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a2hPYzVmdznZPbs3CLdWn7m2i+U9zKyH4lrv7HicM4g='
WHERE
key_id = '0d9f0693e50d4197b1ed0921f573d21a4ffd735575f3bf9ca8a31d7ebeb0a810'
AND (
token = 'a2hPYzVmdznZPbs3CLdWn7m2i+U9zKyH4lrv7HicM4g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)