UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c+VBbJLMwBSKWSyR6vUqgi7Kx1XVMPNNPs0L3D4grEo='
WHERE
key_id = 'a30e30f8e5427b8f79a3aa18205c732a29e6f5a0723da54685bd9ebcf53b2ac1'
AND (
token = 'c+VBbJLMwBSKWSyR6vUqgi7Kx1XVMPNNPs0L3D4grEo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)