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