UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lmkTCSAp+HWfoZShlPYRlcIIjMG1MsodkoHVQ5UFszA='
WHERE
key_id = '2f9f665b56745f17a732c248cd857dbc33baa5203f3a64122774b5b3f4a82ee6'
AND (
token = 'lmkTCSAp+HWfoZShlPYRlcIIjMG1MsodkoHVQ5UFszA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)