UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yCYwZ+Q5IZIylMzibQzUBe62Ub7YZfK4yU/NfyCEGSg='
WHERE
key_id = 'f1b51547f9ec1cedb51869ad195aa56da72210e12e95d44917fdf30495a0a690'
AND (
token = 'yCYwZ+Q5IZIylMzibQzUBe62Ub7YZfK4yU/NfyCEGSg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)