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