UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EGRdza1Gd+1X4a2vvjGuYBIe19H+rbtRJy65bGHEYIs='
WHERE
key_id = '40d457ff767b5d58a8d71c684e11f26d9ef23bf177521c0c5fd2938625f980e5'
AND (
token = 'EGRdza1Gd+1X4a2vvjGuYBIe19H+rbtRJy65bGHEYIs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)