UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'deG8SS2lLbfBTfSVO/cWdaoozB6RqQw4+COAZnOQtrw='
WHERE
key_id = 'cbf99e6a222242e009ccb5e8ca3969477fb647ea1331f70521c50577482d0508'
AND (
token = 'deG8SS2lLbfBTfSVO/cWdaoozB6RqQw4+COAZnOQtrw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)