UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W61su9bjbHC+h53UHkQer/9YJzUspMR9wvXTQcGQvRI='
WHERE
key_id = 'e6515429a1f1e82b6a0b4f4029eefc51d5b7acea23f2bd6e65f4a189e5294a20'
AND (
token = 'W61su9bjbHC+h53UHkQer/9YJzUspMR9wvXTQcGQvRI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)