UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EMrZWHOTK0XCBz12DkA96qOhDZ2UhbkImJVJoBDKW9w='
WHERE
key_id = '87fd430cb1c23a52a774dc2b089872172a6766f8873ce295b5fdce12fb96a7af'
AND (
token = 'EMrZWHOTK0XCBz12DkA96qOhDZ2UhbkImJVJoBDKW9w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)