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