UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tVqV5KCTXYFiQ4KlMAyjEbWLkJXDHswc75mUJTzcVfM='
WHERE
key_id = '02a0518193341e119346a81c3c45de69c53305edfa9787e4a4961f13963b92e9'
AND (
token = 'tVqV5KCTXYFiQ4KlMAyjEbWLkJXDHswc75mUJTzcVfM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)