UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qOVBqoerl9QCb3kSuDwVN1J2neKL3h9a60M/doSHFgM='
WHERE
key_id = '27a5495c3e6c685135c5816ade0311c0e8bdf1a4dbf874607a7907018b1b2819'
AND (
token = 'qOVBqoerl9QCb3kSuDwVN1J2neKL3h9a60M/doSHFgM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)