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