UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aZOBLaSG7sCMyBXSJvqVMRSVaMsllFxgtqUnv1R+pR8='
WHERE
key_id = 'bcaee9ab862ab74ecc9678b3bcb22c40bf9dffa82c2c55daf268f8b9b04c180f'
AND (
token = 'aZOBLaSG7sCMyBXSJvqVMRSVaMsllFxgtqUnv1R+pR8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)