UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sjhoQ4LowrOg4+78jvxgpXbwDuCldyhrePpbFxk99jE='
WHERE
key_id = '21f99d854ac96af34f72cd3920f5dcc7349d7beef477b5db0d79a078cab1139e'
AND (
token = 'sjhoQ4LowrOg4+78jvxgpXbwDuCldyhrePpbFxk99jE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)