UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RDTyU43+JVUiWCr43aqvaFufnnAMwX7hLEkpsFioJX8='
WHERE
key_id = '201615307f2396dfe7f8409429fdb73f195b5101b591b054c4f179341347809d'
AND (
token = 'RDTyU43+JVUiWCr43aqvaFufnnAMwX7hLEkpsFioJX8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)