UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MVPpXUJixZbpP2MQqp8HtbcWqW4Dw4j8oft2Wuw729k='
WHERE
key_id = '50d086f645cab6cb3787f18d758d402ebd936e7f194c412d80f40ae07ad407cf'
AND (
token = 'MVPpXUJixZbpP2MQqp8HtbcWqW4Dw4j8oft2Wuw729k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)