UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'De4J3YrqwaYEJ4HL0lGxi0Za1wSik3eLEOOBOczPMwM='
WHERE
key_id = 'c384389a3d26a5d260cc5659121c5b19eca68a53ccae0a329f1aa61bebd8b6e6'
AND (
token = 'De4J3YrqwaYEJ4HL0lGxi0Za1wSik3eLEOOBOczPMwM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)