UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yB8snsS1xa31qjS5s2mI9nhbESfVwPivCPp2R78IBHA='
WHERE
key_id = '3167373afe7f165d6d4b169b2548c0ba67c574c2407bac1812b8795cde35490b'
AND (
token = 'yB8snsS1xa31qjS5s2mI9nhbESfVwPivCPp2R78IBHA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)