UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/OpFgHezds7wo0kWJNuXExl7ZTDQ6hhL8tgJAcSHSkk='
WHERE
key_id = 'a92ae7de3ec83e17802f16b5dde162176a120fb60f3b02d31a43f0aee699f543'
AND (
token = '/OpFgHezds7wo0kWJNuXExl7ZTDQ6hhL8tgJAcSHSkk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)