UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aRC/DrzOa+1D8XZ2+IYcleTrGqmgK5hL5Y9ub/2Mmh0='
WHERE
key_id = 'dbef8d6c0d30b9205f782ea699942b3d347c274ab97c812e195b56148f391e8b'
AND (
token = 'aRC/DrzOa+1D8XZ2+IYcleTrGqmgK5hL5Y9ub/2Mmh0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)