UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iRJwi7JPG6p/d1sqawDbNrfxMrcCOalkLjAqZn5rQd8='
WHERE
key_id = '2a671619369a09d11e56ee3040a9694b23993b71e7c1d15ed46a1966eb8b0f8d'
AND (
token = 'iRJwi7JPG6p/d1sqawDbNrfxMrcCOalkLjAqZn5rQd8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)