UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cCkiWYHLNbdAJ5vPKNm67jH4ghC+cesdRRiolpP3LAc='
WHERE
key_id = '6fb9d810f9b73d33827d5ed3a424ae0fd40168a3a0e7241d99d4be96ddc70a9d'
AND (
token = 'cCkiWYHLNbdAJ5vPKNm67jH4ghC+cesdRRiolpP3LAc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)