UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'daL8LQQN7pwGEhebNHGk8LAUinlrk1obvJ3/1A4Xv3s='
WHERE
key_id = 'e908cdc9b985a016042a2054aa69bbe809b4711c9dd6f41624d0ce6480668958'
AND (
token = 'daL8LQQN7pwGEhebNHGk8LAUinlrk1obvJ3/1A4Xv3s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)