UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PukY39aBJoIyekW7Q4moc1PUBC8YlByRqqxPswW+lzA='
WHERE
key_id = '380ab68829ee1c8888bd10707b3a98ee93e6baf1702009e83dd2f3496ee5ae8a'
AND (
token = 'PukY39aBJoIyekW7Q4moc1PUBC8YlByRqqxPswW+lzA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)