UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'swF0ZXycvC3v9CDOuirnZ5vJEEdn0XWd2ID59V2Cojk='
WHERE
key_id = '0fdd26056b097fcdbd144cf5dc84b3e7af08824e262e3d259c6642e135c052b7'
AND (
token = 'swF0ZXycvC3v9CDOuirnZ5vJEEdn0XWd2ID59V2Cojk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)