UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EoncLaZg3beuHoC4258qeZsSDdxVCSHgnbZmaTdAak4='
WHERE
key_id = '593497509b174da02e2e605f3981b4d04dc2f54129350b8f05edc586b57c7bdf'
AND (
token = 'EoncLaZg3beuHoC4258qeZsSDdxVCSHgnbZmaTdAak4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)