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