UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HH6kWrXRk6L9BKORYN+YxRTKS+Pj8HKMt2uxkH7Ft3Q='
WHERE
key_id = '8f30f955153cf54190f5766a43575d03b473e8e8854d2579fbee4a4ef177b31f'
AND (
token = 'HH6kWrXRk6L9BKORYN+YxRTKS+Pj8HKMt2uxkH7Ft3Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)