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